package com.lianzheng.dao.impl;

import java.util.List;
import java.util.Map;
import java.util.HashMap;

import com.lianzheng.dao.TbDocArticletypeDAO;
import com.lianzheng.model.TbDocArticletype;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.orm.ObjectRetrievalFailureException;
import org.springframework.stereotype.Repository;


/**
 * This class interacts with Spring's IbatisTemplate to save/delete
 * <p>
 * <a href="TbDocArticletype.DAOimpl.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author <a href="mailto:heymanchen@gmail.com">haihua chen</a>
*/
@Repository
public class TbDocArticletypeDAOimpl extends SqlMapClientDaoSupport implements TbDocArticletypeDAO {

    /**
     * @see com.lianzheng.dao.TbDocArticletypeDAO#getTbDocArticletype($keytype)
     */

    public TbDocArticletype getTbDocArticletype(String typeid){
        return (TbDocArticletype)getSqlMapClientTemplate().queryForObject("getTbDocArticletype", typeid);
    }

    public TbDocArticletype getTbDocArticletypeFull(String typeid){
        return (TbDocArticletype)getSqlMapClientTemplate().queryForObject("getTbDocArticletypeFull", typeid);
    }

    public void addTbDocArticletype(final TbDocArticletype tbDocArticletype) {
        getSqlMapClientTemplate().update("addTbDocArticletype", tbDocArticletype);
    }

    public void updateTbDocArticletype(final TbDocArticletype tbDocArticletype) {
    getSqlMapClientTemplate().update("updateTbDocArticletype", tbDocArticletype);
    }

    public void removeTbDocArticletype(String typeid){
        getSqlMapClientTemplate().update("removeTbDocArticletype", typeid);
    }

    public List getTbDocArticletypes() {
        return getSqlMapClientTemplate().queryForList("getTbDocArticletypes",null);
    }

    public List getTbDocArticletypeByAnd(final TbDocArticletype tbDocArticletype,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_AND, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocArticletype.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocArticletypeByMap", tbDocArticletype);
    }

    public List getTbDocArticletypeByOr(final TbDocArticletype tbDocArticletype,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_OR, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocArticletype.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocArticletypeByMap", tbDocArticletype);
    }
    
    public List getTbDocArticletypeByLike(final TbDocArticletype tbDocArticletype,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_LIKE, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocArticletype.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocArticletypeByMap", tbDocArticletype);
    }
}